<?php
/*
*未成功
*
*
*
*/
header("Content-type: text/html; charset=gbk");
$data = 'admin_username=ibaoli&admin_password=ibaoli@123&admin_questionid=4&admin_answer=雪飞';
$curlobj = curl_init();	//初始化
curl_setopt($curlobj, CURLOPT_URL,"http://www.ibaoli.com/member.php?mod=logging&action=login");
curl_setopt($curlobj, CURLOPT_RETURNTRANSFER, 1);
date_default_timezone_set('PRC');
// curl_setopt($curlobj, CURLOPT_SSL_VERIFYPEER, 0);
// curl_setopt($curlobj, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlobj, CURLOPT_COOKIESESSION, 1);
curl_setopt($curlobj, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curlobj, CURLOPT_COOKIEJAR, "cookiefile");
curl_setopt($curlobj, CURLOPT_COOKIE, session_name() . '='. session_id());
curl_setopt($curlobj, CURLOPT_HEADER, 0);
curl_setopt($curlobj, CURLOPT_FOLLOWLOCATION, 1);	//这样能够让cURL支持页面链接跳转
curl_setopt($curlobj, CURLOPT_POST, 1);
curl_setopt($curlobj, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlobj, CURLOPT_HTTPHEADER, array("application/x-www-form-urlencoded;charset=gbk","Content-length:".strlen($data)));
// curl_setopt($curlobj, CURLOPT_USERAGENT, "user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER");//代理

curl_exec($curlobj);
curl_setopt($curlobj, CURLOPT_URL, "http://www.ibaoli.com/");

curl_setopt($curlobj, CURLOPT_POST, 0);
curl_setopt($curlobj, CURLOPT_HTTPHEADER, array("Content-type:text/xml"));
$output = curl_exec($curlobj);
// echo 'Curl error:'.curl_errno($curlobj);
curl_close($curlobj);
// echo "<base href=\"https://www.imooc.com\">";

echo $output;
